package com.icart.repositories;


import com.icart.entities.MkFwcodeEntity;
import org.springframework.context.annotation.Scope;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Repository
@Scope("prototype")
public interface MkfwcodeRepository extends BaseRepository<MkFwcodeEntity,Integer> {
    @Transactional
    @Query(nativeQuery = true,value = "insert into mk_fwcode(oid,fwcode) values(?1,?2)")
    @Modifying(clearAutomatically = true)

    Integer insert( String oid, String fwcode);

    @Transactional
    @Query(nativeQuery = true,value = "delete from mk_fwcode where id=?1")
    @Modifying(clearAutomatically = true)

    Integer deletecode(Long id);

    @Query(nativeQuery = true,value = "select * from mk_fwcode where oid=?1")
    List<MkFwcodeEntity> fwcode(String oid);
}
